{extend name="base" /}
{block name="body"}
<style type="text/css">
.king {display:inline;display:inline-block;}
</style>
<div class="layui-card">
    <div class="layui-card-body">
<div class="layui-row layui-col-space10">
    <div class="layui-col-lg12 layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header" style="border-bottom: 1px solid #eee;">个人信息</div>
            <div class="layui-card-body">
                <table class="layui-table magt0" lay-even>
                    <colgroup>
                        <col width="15%">
                        <col width="35%">
                        <col width="15%">
                        <col width="35%">
                    </colgroup>
                    <tbody>
                        <tr>
                            <td>上次登录时间</td>
                            <td class="version">{$users.prev_time|date='Y-m-d H:i:s'}</td>
                            <td>性别</td>
                            <td class="version">{$users.sex==1?'男':($users.sex==2?'女':'未知')}</td>
                        </tr>
                        <tr>
                            <td>最后登录时间</td>
                            <td>{$users.login_time|date='Y-m-d H:i:s'}</td>
                            <td>登录次数</td>
                            <td>{$users.login_num??'0'}</td>
                        </tr>
                        <tr>
                            <td>余额</td>
                            <td>{$users.money}</td>
                            <td>积分</td>
                            <td class="server">{$users.score}</td>
                        </tr>
                        <tr>
                            <td>连续登录天数</td>
                            <td>{$users.successions}</td>
                            <td>最大连续登录天数</td>
                            <td>{$users.maxsuccessions}</td>
                        </tr>
                        <tr>
                            <td>等级</td>
                            <td>{$users.level}</td>
                            <td>手机号</td>
                            <td>{$users.mobile|default=''}</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

        <form action="{:request()->url()}" class="layui-form" method="post">  

                    <input type="hidden" name="id" value="{$users.id}" /> 
             <div class="layui-form-item">
                   <label class="layui-form-label">头像图片</label>
                 <div class="layui-input-inline">
                        <div class="profile-avatar-container">
                  <img id="image" class="profile-user-img img-responsive" src="{$users.avatar}" alt="">
            <span class="layui-upload-list">
                   <div class="profile-avatar-text">{:__('Click Edit')}</div>
               <button type="button" id="ajax-admin-avatar"><i class="fa fa-upload"></i>{:__('Edit')}</button>
            </span>
            <span class="layui-upload-list" style="padding-left: 20px;"></span>
                       </div>
                   </div>
            <input type="hidden" name="filesize" id="filesize" value="">
            <input type="hidden" name="mine" id="mine" value="">
            <input type="hidden" name="image" value="">
           </div>
          
            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline">
                <input type="text" name="username" id="username" value="{$users.username|default=''}" lay-verify="required"
                       placeholder="会员名" autocomplete="off" class="layui-input" readonly="readonly">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
           
                <input type="radio" name="sex" value="0" {if isset($users.sex) and $users.sex == 0}checked="checked"{/if} title="未知"  />
                <input type="radio" name="sex" value="1" {if isset($users.sex) and $users.sex == 1}checked="checked"{/if} title="男"  />
                <input type="radio" name="sex" value="2" {if isset($users.sex) and $users.sex == 2}checked="checked"{/if} title="女" />
        </div>
    </div>
            <div class="layui-form-item">
                <label class="layui-form-label">{:__('QQ')}</label>
                <div class="layui-input-inline">
                    <input type="text" id="qq" name="qq" value="{$users.qq|default=''}" autocomplete="off" placeholder="请输入QQ号" lay-verify="qq|number" class="layui-input" lay-verify="required">
                </div>
            </div>
 
            <div class="layui-form-item">
                <label class="layui-form-label">手机号</label>
                <div class="king">
                     <input type="text" value="{$maskedNumber|default=''}" autocomplete="off" placeholder="请输入手机号" class="layui-input" lay-verify="required" readonly="readonly" style="margin-right:-40px;">
                     <input type="hidden" id="mobile" name="mobile" value="{$users.mobile|default=''}" lay-verify="phone|number">
                     </div>                                    
                      <div class="king"> 
                     <a href="{:url('user/mobile')}" class="layui-btn layui-btn-sm ajax-iframe" data-width="410px" data-height="310px">{:__('modify')}</a>
                     </div>
            </div>
            
     
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="king">
                     <input type="text" value="{$server|default=''}" autocomplete="off" placeholder="请输入邮箱" class="layui-input" lay-verify="required" readonly="readonly" style="margin-right:-40px;">
                     <input type="hidden" name="email" value="{$users.email|default=''}" autocomplete="off" placeholder="请输入邮箱" class="layui-input" lay-verify="required" readonly="readonly" style="margin-right:-40px;">
                     </div>                                     
                     <div class="king"> 
                     <a href="{:url('user/email')}" class="layui-btn layui-btn-sm ajax-iframe" data-width="410px" data-height="310px">{:__('modify')}</a>
                     </div>
            </div>       
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-sm" lay-filter="save" lay-submit="">保存</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}

{block name="js"}
<script>
layui.use(function () {
            // Tab的切换功能，切换事件监听等，需要依赖element模块
            var $ = layui.jquery, upload = layui.upload, form = layui.form, layer = layui.layer;       
             form.render();
   //普通图片上传
      var uploadInst = upload.render({
    elem: '#ajax-admin-avatar',
            exts: 'jpg|png|jpeg|gif|svg',
            size: 2048,
    url: "{:url('upload/uploadImage',['model'=>'3'])}", //Change to your own upload interface
    done: function (result) {
        //上传完毕回调
        if (result.code === 1) {
            $('#image').attr('src', result.url);
            //this.item.prev('input').val(result.url);
            $('input[name="image"]').val(result.url);
            $('input[name="filesize"]').val(result.filesize);
            $('input[name="mine"]').val(result.mine);
            layer.msg(result.msg, {icon: 1});
        } else {
            layer.msg(result.msg, {icon: 2});
        }
    }
        });
});
</script>
{/block}

